#pragma once
/*!
 * \file 
 * UtilRender.h
 */

/*!
 * \brief Changing color space and making BMP file
 *
 * class for changing color space or making BMP file from RGB buffer
 *
 * - header file: UtilRender.h
 * - lib: util.lib
 * - DLL: util.dll
 */

class AFX_EXT_CLASS CUtilRender
{
public:
	CUtilRender(void);		/**< constructor 	*/
	~CUtilRender(void);		/**< destructor 	*/

	/*!
	 * convert color space from RGB 32bit to RGB 24bit
	 * @param pTarget target buffer to be changed
	 * @param pSource source buffer to be changing
	 * @param nWidth image width
	 * @param nHeight image height
	 *
	 */
	void Rgb32ToRgb24(LPBYTE pTarget, LPBYTE pSource, int nWidth, int nHeight);
	void Yuv422ToRgb24(LPBYTE pTarget, LPBYTE pSource, int nWidth, int nHeight);
	void Yv12ToRgb24(unsigned char *pYv12, unsigned char *pRgb24, int w, int h, BOOL bFlip=FALSE);
	
	/*!
	 * file out to bitmap file from RGB 32bit image buffer
	 *
	 * @param tzFile target file path
	 * @param pSource source buffer to be changing
	 * @param nWidth image width
	 * @param nHeight image height
	 */
	BOOL Rgb32ToBitmap(TCHAR* tzFile, LPBYTE pSource, int nWidth, int nHeight);

private:
	WORD GetCRC16(BYTE *pBuffer, DWORD nCount);
};

